package game.views;

import hx.geom.ColorTransform;
import hx.display.Box;

/**
 * 加载进度圆形条
 */
@:build(hx.macro.UIBuilder.build("assets/views/LoadProgress.xml"))
class LoadProgress extends Box {
	override function onStageInit() {
		super.onStageInit();
		this.cdbg.colorTransform = new ColorTransform(0, 0, 0, 1);
		this.cdbg.alpha = 0.3;
		this.setProgress(0);
	}

	/**
	 * 设置进度条进度
	 * @param progress 0-1
	 */
	public function setProgress(progress:Float) {
		this.progressText.data = Std.string(Std.int(progress * 100)) + "%";
		this.progress.stopAt(Std.int(progress * 100) - 1);
	}
}
